package com.ophiux.lock.redis.redisLock;

import lombok.Getter;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @desc:
 * @author: hhl
 * @date：2021/11/3 9:47
 */
@Getter
public class RedisInfo {

    /**
     * 锁的状态 status=true,标识获取锁成功
     */
    private boolean state;

    /**
     * 锁的id
     */
    private String lockId;

    /**
     * 锁的持有线程
     */
    private Thread lockThread;

    /**
     * 锁的过期时间
     */
    private Long expire;

    /**
     * 续命次数
     */
    private AtomicInteger lifeCount;

    /**
     * 可重入次数
     */
    private AtomicInteger reentrantCount;


    public RedisInfo() {
    }

    public RedisInfo(String lockId, Thread lockThread, Long expire) {
        this.lockId = lockId;
        this.lockThread = lockThread;
        this.expire = expire;
    }

    public RedisInfo(boolean state) {
        this.state = state;
    }
}
